package ma.co.ba.BusinessApplications.presentation.components;

import java.beans.PropertyEditorSupport;

import ma.co.ba.BusinessApplications.business.prestations.PrestationBusiness;
import ma.co.ba.BusinessApplications.model.Prestation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class PrestationEditor extends PropertyEditorSupport {

	@Autowired
	PrestationBusiness prestationBusiness;

	@Override
	public void setAsText(String text) {
		// Country c = this.countryService.findById(Long.valueOf(text));
		Prestation prestation = this.prestationBusiness
				.getPrestationById(Integer.valueOf(text));
		this.setValue(prestation);
	}

}